package com.agritech.command;

import com.agritech.machine.AgriculturalMachineContext;

public class StopMachineCommand implements Command {
    private AgriculturalMachineContext machine;

    public StopMachineCommand(AgriculturalMachineContext machine) {
        this.machine = machine;
    }

    @Override
    public void execute() {
        System.out.println("命令模式: 准备执行停止农机 [" + machine.getMachineId() + "] 命令。");
        machine.stop();
    }

    @Override
    public void undo() {
        System.out.println("命令模式: 准备撤销停止农机 [" + machine.getMachineId() + "] 命令 (即启动)。");
        machine.start(); // 撤销停止通常是启动
    }
}